<?php 
namespace Admin\Model;

use \Think\Model;

class UserModel extends Model
{
    protected $_validate = array(
        // array(验证字段1,验证规则,错误提示,[验证条件,附加规则,验证时间]),
        array('name','require','名字不能为空'),//有待测试
        array('name','','用户名称已经存在！',0,'unique',3),
        array('tel','/^1[3|4|5|7|8]\d{9}$/','手机不准确',0,'regex',3),
        array('pass','/^\w{6,32}/','密码格式不正确',0,'regex',3),
        array('email','email','邮箱格式不正确'),
    );

    protected $_auto = array(
        // array(验证字段1,完成规则,[完成条件,附加规则]),
        // array('regtime',"date('Y-m-d H:i:s')",1,'function'),
        array('pass','md5',3,'function'),
        array('pass','',2,'ignore'),
        array('regtime','regdate',1,'callback'),
    );

    protected function regdate()
    {
        return date("Y-m-d H:i:s");
    }
}





